package stage_1_module_1.code;

import java.util.Scanner;

/***
 * 编程题提示用户输入年月日信息，判断这一天是这一年中的第几天并打印。
 * 1.提示用户分别输入年y，月m，日d三个入参
 * 2.初始化12个月的天数数组days
 * 3.判断当前年y是否为闰年，如果为闰年更新days[1]=29
 * 4.从1到m循环，取days[i-1]的整月天数累加
 * 5.最后累加当月天数d
 */

public class homework_1 {
    public static void main(String[] args) {
        int[] days = {31,28,31,30,31,30,31,31,30,31,30,31};
        Scanner sc = new Scanner(System.in);
        System.out.println("输入年份");
        int y = sc.nextInt();
        System.out.println("输入月份");
        int m = sc.nextInt();
        System.out.println("输入天数");
        int d = sc.nextInt();
        sc.close();
        if (((y%4==0) && (y%100 !=0)) || (y%400 == 0)) {
            days[1] = 29;
        }

        int total = 0;
        for (int i=1; i<m; i++) {
            total += days[i-1];
        }
        total += d;
        System.out.printf("当前是第%d天",total);
    }
}
